/*
 * @Author: liuzehai
 * @Date: 2021-04-16 16:34:02
 * @LastEditTime: 2021-05-10 17:19:03
 * @LastEditors: liuzehai
 * @FilePath: /Card-to-payh5/src/api/app.js
 * @Description: 由liuzehai创建！
 */

import request from '@/plugins/axios';

//APP二期 分页查询党组织活动
function activityList(query) {
  return request({
    url: 'party/pageInterface/findAllAndroidByPage',
    method: 'get',
    params: query
  })
}

//APP二期 查看党组织活动时增加浏览量
function pageInterface(id) {
  return request({
    url: 'party/pageInterface/increasePageViews/' + id,
    method: 'post',
  })
}

//APP二期 根据签到表ID查询党组织活动
function pageInterfaceDetail(id) {
  return request({
    url: 'party/pageInterface/findOneById/' + id,
    method: 'get',
  })
}

// APP二期 党组织活动将签到变为已签到
const updateSignStatus = (query) => request({
  url: 'party/pageInterface/updateSign',
  method: 'POST',
  params: query
})

//APP二期 党组织活动将未报名状态变为已报名
function pageInterfaceSign(query) {
  return request({
    url: 'party/pageInterface/updateApply',
    method: 'post',
    params: query
  })
}

// 根据ID修改党员部分信息
const updatePartyById = (data) => request({
  url: 'party/pageInterface/updatePartyById',
  method: 'POST',
  data
})

// 根据身份证号码查询单个党员详情
const findPartyByIdCard = (params) => request({
  url: 'party/pageInterface/findPartyByIdCard',
  method: 'GET',
  params
})

// 分页查询党建指导员工作记录
const queryRecordByCreateId = (params) => request({
  url: 'party/pageInterface/findByCreateId',
  method: 'GET',
  params
})

// 添加党建指导员工作记录
const savePoliticalInstructorWork = (data) => request({
  url: 'party/pageInterface/savePoliticalInstructorWork',
  method: 'POST',
  data
});

// 根据党建指导员createId查询企业
const findByInstructorId = () => request({
  url: 'party/pageInterface/findByInstructorId',
  method: 'GET',
});

// 获取的部门数据根据名称模糊查询
export const getMechanismListByName = (params) => request({
  url: 'upms/dept/currentTreeByName',
  params,
});

// APP分页查询 示范引领 传 1 信息速递 传 2
export const findInterFaceByType = (params) => request({
  url: 'party/pageInterface/findByType',
  params,
});

// APP分页查询 根据ID查询党建要闻
export const findInterFaceById = (id) => request({
  url: 'party/pageInterface/findById/' + id,
});

//APP二期 通知通告 分页查询
const findAnnouncementList = (params) => request({
  url: 'party/pageInterface/findAnnouncement',
  params,
});

//APP二期 通知通告 查询单个详细
function findAnnouncementById(id) {
  return request({
    url: 'party/pageInterface/findAnnouncementById/' + id,
    method: 'get',
  })
}

export const partyAndRecord = {
  updatePartyById,
  findPartyByIdCard,
  queryRecordByCreateId,
  findByInstructorId,
  savePoliticalInstructorWork,
}

export default {
  activityList,
  pageInterface,
  pageInterfaceDetail,
  updateSignStatus,
  pageInterfaceSign,
  findAnnouncementList,
  findAnnouncementById
}